<!DOCTYPE html>
<html lang="en">
<head>
    <title>AI检索</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="static/css/platform2.css">
    <link rel="stylesheet" href="static/easyui/themes/default/easyui.css">
    <link href="static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
    <link href="static/easyui/demo/demo.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="static/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/js/main.js"></script>
</head>
<body>
推荐问题：
<p>1.请查询出延长油田在上个月的上传文件</p>
<p>2.请查询出延长油田张三在上个月的上传文件</p>
<p>3.请查询出延长油田去年的上传文件</p>
<br/>
请输入您的问题...
<div style="margin-bottom:20px">
    <input id="question" class="easyui-textbox" labelPosition="top" multiline="true" value="" style="width:50%;height:120px">
</div>
<div class="btn-selection">
    <a href="javascript:submitForm();" class="easyui-linkbutton save-btn" data-options="selected:true">提交</a>
    <a href="javascript:resetForm();" class="easyui-linkbutton reset-btn" data-options="selected:true">重置</a>
</div>

<div class="container">
    <div id="pf-bd">
        <div id="pf-page">
            <div id="tb" style="padding:0 30px;">
<!--                开始时间：<input id="dt1" type="text" name="birthday" style="width:166px;height:35px;line-height:35px;">-->
<!--                结束时间：<input id="dt2" type="text" name="birthday" style="width:166px;height:35px;line-height:35px;">-->
<!--                关键词: <input type="text" id="payerCode" name="payerCode"-->
<!--                               style="width:166px;height:35px;line-height:35px;"/>-->
<!--                <a href="javascript:search()" id="" class="easyui-linkbutton"-->
<!--                   data-options="iconCls:'icon-search'">查询</a>-->
                <a href="json/data_list.json" download class="easyui-linkbutton"
                   data-options="iconCls:'icon-save'">下载</a>
                <a href="javascript:batchRemove()" class="easyui-linkbutton"
                   data-options="iconCls:'icon-remove'">删除</a>
                <a href="javascript:batchRemove()" class="easyui-linkbutton"
                   data-options="iconCls:'icon-remove'">移动</a>
                <a href="javascript:$('#dlg').dialog('open');" class="easyui-linkbutton"
                   data-options="iconCls:'icon-add'">加标签</a>
            </div>
            <table id="dg"></table>
        </div>
    </div>
</div>


<!-- 进度条的弹框 -->
<div id="dlg-progressbar" class="easyui-dialog" title="文件重命名" style="width:400px;height:200px;padding:10px"
     data-options="iconCls: 'icon-save',buttons: '#dlg-progressbar-buttons'">
    <div class="container">
        <span id="infoText">正在分析，请稍后</span>
        <div id="p" class="easyui-progressbar" style="width:100%;"></div>
    </div>
</div>
<div id="dlg-progressbar-buttons">
    <a href="javascript:void(0)" class="easyui-linkbutton"
       onclick="javascript:$('#progressbar').dialog('close')">关闭</a>
</div>
<div id="topWindow"></div>
<script type="text/javascript">
    $(function () {
        $('#dlg-progressbar').dialog('close');


    });

    /* 打开在父窗口中打开window */
    function openTopWindow(options) {
        options = !options ? {} : options;
        options.width = !options.width ? 500 : options.width;
        options.height = !options.height ? 400 : options.height;
        options.url = !options.url ? "404.html" : options.url;
        options.title = !options.title ? "" : options.title;

        parent.$("#topWindow").window({
            title: options.title,
            width: options.width,
            height: options.height,
            content: "<iframe scrolling='no' frameborder='0' border='0' height='100%' width='100%' src='" + options.url + "'></iframe>",
            modal: true,
            resizable: false,
            collapsible: false
        });
    }

    function submitForm() {
        // openTopWindow({
        //     width:500,
        //     height:200,
        //     title: "进度条",
        //     url: "aiSearchAlert.html"
        // })
        $('#dlg-progressbar').dialog('open');
        var value = $('#p').progressbar('getValue');
        if (value < 100) {
            if (value > 30) {
                $("#infoText").text("正在检索中，请稍后")
            }
            if (value > 60) {
                $("#infoText").text("检索完成，正在返回结果，请稍后")
            }
            value += Math.floor(Math.random() * 10);
            $('#p').progressbar('setValue', value);
            setTimeout(arguments.callee, 200);
        } else {
            $("#infoText").text("结果返回完毕");
            $('#dlg-progressbar').dialog('close');

            $("#dg").datagrid({
                title: "资料列表",
                method: "get",
                url: 'json/data_list.json',
                striped: true,
                pagination: true,
                pageNumber: 1,
                pageList: [2, 5, 10, 20, 30],
                rownumbers: true,
                pagePosition: "bottom",
                columns: [[
                    {field: "ck", checkbox: "true"},
                    {field: "order", title: '序号', width: 100},
                    {field: "filename", title: '文件名', width: 100},
                    {field: "updateTime", title: '上传时间', width: 150},
                    {field: "updateUser", title: '上传用户', width: 100},
                    {field: "filePath", title: '所在文件夹', width: 200},
                    {field: "fileSize", title: '文件大小', width: 100},
                    {field: "tags", title: '标签列表', width: 100},
                    {
                        field: "option", title: '操作', width: 150,
                        formatter: function (value, rowData, index) {
                            return "<a href='javascript:void(0)' onclick='remove(" + rowData.id + ")'>删除   </a>"
                                + "<a href='javascript:void(0)' onclick='toRename(" + rowData.id + ")' >重命名  </a>"
                                + "<a href='javascript:void(0)' onclick='preview(" + rowData.id + ")' >预览  </a>"

                        }
                    }
                ]],
                loadFilter: function (data) {
                    var pager = $('#dg').datagrid('getPager'); // 获取分页器对象
                    var options = pager.pagination('options'); // 获取分页器的选项
                    // 注意：以下代码是客户端分页的示例，但通常不推荐这样做，因为性能问题
                    var start = (options.pageNumber) * options.pageSize;
                    var rows = data.slice(start, start + options.pageSize);
                    console.log({total: data.length, rows: rows})
                    return {total: data.length, rows: rows};

                }
            });

        }
    }

    function resetForm() {
        $('#question').textbox('setValue', '');
    }
</script>
</body>
</html>